<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title></title>
  <link rel="stylesheet" href="js/bower_components/bootstrap/dist/css/bootstrap.css" />
  <script src="js/bower_components/bootstrap/dist/js/bootstrap.js"></script>
  <script src="js/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
  <script src="js/jquery-3.4.0.min.js"></script>
  <script>
    $(function(){
      $("#login").click(function(){
        console.log("进入登录方法");
        MyUser={
          "userName": $("#txtUserName").val(),
          "pwd": $("#txtPwd").val()
        }
        console.log("获得当前界面中的值");
        console.log(MyUser);
        $.ajax({
          type:"put",
          url:"http://localhost:8801/myUser/getAll",
          contentType: "application/json;charset=utf-8",
          data: JSON.stringify(MyUser),
          dataType: "json",
          success: function(res) {
            console.log(res);
            if (res.length == 1) {
              alert("登录成功");
            }else{
              alert("登录失败");
            }
          },
          error: function(myError) {
            alert("登陆失败");
          }
        })
      })
    })
  </script>
</head>
<body>
  <div class="panel-heading"><h2>登录</h2></div>
  <div class="panel-body">
    <div class="input-group">
      <span class="input-group-addon" id="basic-addon1">
        <span class="glyphicon glyphicon-user"></span>
      </span>
      <input type="text" id="txtUserName" name="txtUserName" class="form-control" placeholder="输入账号">
    </div>
    <br />
    <div class="input-group">
      <span class="input-group-addon" id="basic-addon1">
        <span class="glyphicon glyphicon-lock"></span>
      </span>
      <input type="text" id="txtPwd" name="txtPwd" class="form-control" placeholder="输入密码">
    </div>
    <br />
    <div class="btn-group-lg text-right">
      <button id="login" type="button" class="btn btn-success">登录</button>
      <button id="zhuce" type="button" class="btn btn-default">注册</button>
    </div>
  </div>
  
</body>
</html>